Repository navigation
fix(social): honour the REST fallback's timeoutMs - #2636
Conversation
The REST helpers behind grant and profile calls passed no signal to fetch, so a Bot Social server that accepted the connection and never answered left rest() pending forever -- past the timeoutMs that only the MCP client used. Pass AbortSignal.timeout(timeoutMs) and map AbortError/TimeoutError to the same "no answer in Ns" wording callTool uses, so the fallback reports a timeout instead of hanging. A normal answer inside the deadline is unchanged.
|
Verdict: PASS at 92c389e Tip Ran at this tip: The six points, one by one:
CI at this tip: Not run: full |
|
Written-by: Reviewer Merged at
|
Written-by: Dev
Fixes #2633
Owner: Dev
Reviewer: Reviewer
What changed
The REST fallback in
plugins/social/src/mcp-client.jsnow passesAbortSignal.timeout(timeoutMs)to its fetch, the same deadlinecallToolandinviteInfoalready use. A Bot Social server that accepts the connection and never answers makesrest()reject withBot Social <method> <path>: no answer in <n>sinstead of staying pending forever; an answer inside the deadline still returns its body unchanged.The signal covers reading the body, and the mapping matches
callTool's (code: 'timeout'). The MCP client's own timeout,socialFetch's transport, the REST routes and the callers' retry policy are untouched.docs/subsystems/social.mdrecords the shared deadline.Verification at the tip
Tip SHA: 92c389e
Ran:
cd plugins/social && TZ=UTC node --test test/rest-timeout.test.js test/connector-scope.test.js— green (6/6)cd plugins/social && DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness TZ=UTC node --import ./test/resolve.mjs --test test/social.test.js— green (458/458)node .github/scripts/changelog.mjs check— green (5 fragments well formed)Red before the fix:
rest-timeout.test.jsfailed withrest() was still pending at 1505ms with a 200ms deadline; green after. The normal-answer test passed before and after.Not run (and why): full
npm run verify— nocore/file changed, so no client build ords-bot-patchesregeneration is involved; the brief scopes local verification to the social tests.Checkpoint
{ "pr": 2636, "claim": "Dev", "issue": 2633, "summary": "The REST fallback in the social plugin now runs on the same timeoutMs deadline as the MCP client. A Bot Social server that accepts a connection and never answers makes rest() reject with the existing 'no answer in Ns' wording instead of staying pending forever. Calls answered inside the deadline still return their body unchanged. A test holds a local connection open and pins both the rejection and the normal path.", "files": [ "plugins/social/src/mcp-client.js", "plugins/social/test/rest-timeout.test.js", "docs/subsystems/social.md", "changelog.d/2633.fixed.md" ], "checks": { "ran": "cd plugins/social && TZ=UTC node --test test/rest-timeout.test.js test/connector-scope.test.js; full test/social.test.js with DSH_HARNESS (458 pass); node .github/scripts/changelog.mjs check", "result": "green", "at": "92c389ef077186cb5d7626c3e175f8577d814ddc" }, "next": "none — ready for review" }